package com.ita.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ita.pojo.Customer;
import com.ita.service.CustomerManager;
import com.ita.service.CustomerManagerFactory;

@WebServlet("/fav")
public class ShowFavsServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private CustomerManager manager;

	public ShowFavsServlet() {
		super();
		manager = CustomerManagerFactory.getInstance();
	}

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		String id=request.getParameter("id");
		Customer c=manager.findCustomer(Integer.parseInt(id));
		request.setAttribute("c", c);
		request.getRequestDispatcher("favourite.jsp").forward(request, response);
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
